{% extends "base.html" %} {% block title %}发布帖子 - 运动健康管理系统{%
endblock %} {% block content %}
<div class="container py-5">
  <nav aria-label="breadcrumb">
    <ol class="breadcrumb">
      <li class="breadcrumb-item">
        <a href="{{ url_for('community') }}">社区交流</a>
      </li>
      <li class="breadcrumb-item active" aria-current="page">发布帖子</li>
    </ol>
  </nav>

  <!-- 显示闪现消息 -->
  {% with messages = get_flashed_messages() %} {% if messages %} {% for message
  in messages %}
  <div class="alert alert-info alert-dismissible fade show" role="alert">
    {{ message }}
    <button
      type="button"
      class="btn-close"
      data-bs-dismiss="alert"
      aria-label="Close"></button>
  </div>
  {% endfor %} {% endif %} {% endwith %}

  <div class="card shadow">
    <div class="card-body p-4">
      <h2 class="card-title text-center mb-4">
        <i class="bi bi-pencil-square"></i> 发布新帖子
      </h2>

      <form method="POST" action="{{ url_for('create_post') }}">
        <div class="mb-3">
          <label for="title" class="form-label">标题</label>
          <input
            type="text"
            class="form-control"
            id="title"
            name="title"
            required />
        </div>

        <div class="mb-3">
          <label for="content" class="form-label">内容</label>
          <textarea
            class="form-control"
            id="content"
            name="content"
            rows="6"
            required></textarea>
        </div>

        <div class="d-grid gap-2">
          <button type="submit" class="btn btn-primary">发布帖子</button>
          <a href="{{ url_for('community') }}" class="btn btn-outline-secondary"
            >取消</a
          >
        </div>
      </form>
    </div>
  </div>
</div>
{% endblock %}
